<template>
  <div class="png_scanview">
    <div class="png_list">
      <div class="vue-hover-mask">
        <img src="@/assets/img/order_yachiYellow.png" alt="" />
        <slot></slot>
        <span class="vue-hover-mask_action" @click="handleClick">
          <i class="el-icon-delete" @click="deleteHanlde"></i>
          <slot name="action"></slot>
        </span>
      </div>

      <!-- <img src="@/assets/img/order_yachiYellow.png" alt=""> -->
    </div>
    <el-upload
      class="upload"
      action="#"
      :on-preview="handlePreview"
      :on-remove="handleRemove"
      :before-remove="beforeRemove"
      multiple
      :limit="3"
      :on-exceed="handleExceed"
      :file-list="fileList"
    >
      <el-button type="text" icon="el-icon-search" :size="tableButtonSize">{{
        $t('add.add149')
      }}</el-button>
    </el-upload>
  </div>
</template>

<script>
export default {
  name: 'BLZMasterIndex',

  data() {
    return {
      fileList: [],
      dialogImageUrl: '',
      dialogVisible: false,
      disabled: false,
    };
  },

  mounted() {},

  methods: {
    // 删除
    deleteHanlde() {},
    handleClick() {
      console.log('click');
    },
    handleRemove(file, fileList) {
      console.log(file, fileList);
    },
    handlePreview(file) {
      console.log(file);
    },
    handleExceed(files, fileList) {
      this.$message.warning(
        `当前限制选择 3 个文件，本次选择了 ${files.length} 个文件，共选择了 ${
          files.length + fileList.length
        } 个文件`,
      );
    },
    beforeRemove(file, fileList) {
      return this.$confirm(this.$t('yulan.yulan97') + `${file.name}？`);
    },
  },
};
</script>

<style lang="scss" scoped>
.png_scanview {
  margin-top: 20px;
  padding: 10px 12px;
  width: 450px;
  height: 150px;
  background-color: #f4f4f4;
  border: 6px;

  .png_list {
    display: flex;

    img {
      margin-right: 10px;
      width: 100px;
      height: 100px;
    }

    .vue-hover-mask {
      overflow: hidden;
      position: relative;
      line-height: 1;
      background-color: #fff;
      border-radius: 6px;
      box-sizing: border-box;
      display: inline-block;
      font-size: 0;
      vertical-align: middle;
    }

    .vue-hover-mask_action {
      position: absolute;
      width: 100%;
      height: 100%;
      left: 0;
      top: 0;
      cursor: pointer;
      text-align: center;
      color: #fff;
      opacity: 0;
      font-size: 20px;
      z-index: 1;
      background-color: rgba(0, 0, 0, 0.4);
      transition: opacity 0.3s;
    }

    .vue-hover-mask_action::after {
      display: inline-block;
      content: '';
      height: 100%;
      vertical-align: middle;
    }

    .vue-hover-mask_action:hover {
      opacity: 1;
    }
  }
}
</style>
